<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">
  <head>
    <title>Canvas drawImage example 1</title>
    <meta name="DC.creator" content="Kamiel Martinet, http://www.martinet.nl/">
    <meta name="DC.publisher" content="Mozilla Developer Center, http://developer.mozilla.org">

    <script type="text/xaml" id="xaml"><?xml version="1.0"?>
      <Canvas xmlns="http://schemas.microsoft.com/client/2007"></Canvas></script>
<script type="text/javascript" src="../uupaa-excanvas.js"></script>

    <script>
    function boot() {
      draw(document.getElementById('canvas').getContext('2d'));
      draw(document.getElementById('vmlcanvas').getContext('2d'));
    }
    function draw(ctx) {
      var img = new Image();
      img.onload = function(){
        ctx.scale(1, 0.3);
        ctx.translate(20, 20);
        ctx.rotate(3 * Math.PI / 180);
        ctx.beginPath();
        ctx.arc(80, 100, 80, 0, Math.PI * 2, 1);
    //    ctx.rect(100, 100, 100, 100);
        ctx.clip();
        ctx.strokeStyle = "red";
        ctx.lineWidth = 3;
        ctx.drawImage(img, 0, 0);
        ctx.stroke();
      }
      img.src = 'images/rhino.jpg?' + new Date().getTime();
    }
    </script>
    <style type="text/css">
      body { margin: 20px; font-family: arial,verdana,helvetica; background: #fff;}
      h1 { font-size: 140%; font-weight:normal; color: #036; border-bottom: 1px solid #ccc; }
      h2 { font-size: 100%; color: #036; }
      canvas { float: left; margin-right: 20px; margin-bottom: 20px; }
      pre { float:left; display:block; background: rgb(238,238,238); border: 1px dashed #666; padding: 15px 20px; margin: 0 0 10px 0; }
    </style>
  </head>
  <body onload="uuCanvas.ready(boot);">
    <h1>Canvas <code>drawImage</code> example 1</h1>
    <div>
      <canvas id="canvas" width="180" height="130"></canvas>
      <canvas id="vmlcanvas" class="vml" width="180" height="130"></canvas>
      <pre>
function boot() {
  draw(document.getElementById('canvas').getContext('2d'));
  draw(document.getElementById('vmlcanvas').getContext('2d'));
}
function draw(ctx) {
  var img = new Image();
  img.onload = function(){
    ctx.scale(1, 0.3);
    ctx.translate(20, 20);
    ctx.rotate(3 * Math.PI / 180);
    ctx.beginPath();
    ctx.arc(80, 100, 80, 0, Math.PI * 2, 1);
//    ctx.rect(100, 100, 100, 100);
    ctx.clip();
    ctx.strokeStyle = "red";
    ctx.lineWidth = 3;
    ctx.drawImage(img, 0, 0);
    ctx.stroke();
  }
  img.src = 'images/rhino.jpg?' + new Date().getTime();
}
      </pre>
      <div style="float:left;">
        <h2>Source image</h2>
        <img src="images/rhino.jpg"/>
      </div>
    </div>
  </body>
</html>
